<script>
function showList(val)
{
      $.ajax({  
            type: "GET",  
            url: "<?php echo base_url();?>administrator/project/list_data/"+val,  
            dataType : 'html',
            beforeSend: function() 
            {
                $("#loading").html('<img src="<?php echo base_url();?>public/images/ajax-loader.gif" align="absmiddle" alt="Loading...">');
                $("#dis_play_data").css("opacity","0.4");
            },  
            success: function(response)
            {
               $("#dis_play_data").css("opacity","1"); 
               $("#loading").html('');
               $("#dis_play_data").html(response);
               
            }
      });
}
</script>
<div id="page_list">
    <h2>Project list</h2>
    
    <div id="dropdow">
        <label>Filter by:</label>
        <select  name= "list" onchange = "showList(this.value);" >
            <option  value="0">Unfinished project</option>
            <option  selected="selected" value="1">Finished project</option>
            
            
        </select>
        
    </div>

    
    <div>
        <a class="addnew" style="float:left;" href="<?php echo base_url();?>administrator/project/add">+ Add new Project</a>
        <a class="addnew" style="float:right;" href="<?php echo base_url();?>administrator/project/apply">+ Apply template</a>
    </div>
    <div id="loading" style="margin-left: 30%;z-index: 1;position: absolute;margin-top: 15%;"></div>
    <div id="dis_play_data">
        <table class="list" cellpadding="0" cellspacing="0">
            <thead>
                <tr>
                    <th width="5%">Id</th>
                    <th width="15%">Owner</th>
                    <th width="10%">Status</th>
                    <th width="70%">Actions</th>
                </tr>
            </thead>
            
            <tbody>        
                <?php
                    foreach($data as $k=>$v) {
                    ?>
                 <?php ?> 
                        <tr>
                            <td><?php echo $v['project_id'];?></td>
                            <td><?php echo $v['user_id'];?></td>
                            <td><?php echo $v['finished'];?></td>
                            <td>
                                <a href="<?php echo base_url();?>administrator/project/edit/<?php echo $v['project_id'];?>">Edit</a>
                                <a rel="<?php echo base_url();?>administrator/project/delete/<?php echo  $v["project_id"];?>" href="#" class="confirmDelete">Delete</a>
                                <a href="export/<?php echo $v['project_id'];?>">Export</a>
                            </td>
                        </tr>
                        <?php
                    }
                ?>
            
        </table>
    </div>
</div>